package com.fengdi.everyday.middle;

/**
 * @Description 2536 子矩阵元素+1
 * @Date 17:18
 */
public class RangeAddQueries {
    private int[][] ans;

    public int[][] rangeAddQueries(int n, int[][] queries) {
        this.ans = new int[n][n];
        for(int[] query : queries) {
            this.increase(query);
        }

        return this.ans;

    }

    private void increase(int[] query) {
        int n = this.ans.length;
        int x1 = query[0], y1 = query[1], x2 = query[2], y2 = query[3];
        for(int i = x1; i <= x2; i++) {
            for(int j = y1; j <= y2; j++) {
                this.ans[i][j]++;
            }
        }
    }

    // 前缀和实现
    public int[][] rangeAddQueriesV2(int n, int[][] queries) {
        
    }
}
